<?php
/**
 * Created by PhpStorm.
 * User: dev
 * Date: 22/11/14
 * Time: 3:50 PM
 */

class Products_Widget_Recent_Controller extends Base_Controller {

    public $restful = true;

    public function __construct()
    {
        parent::__construct();
        //--Your Code --//

    }

    public function get_list($column=1, $limit=1){

    	$data['mode'] = "LIST";
    	//$data['mode'] = "PRODUCTS";
        $sql = "Select * from products where status = 51 order by('id') DESC limit 0,$limit ";
        $result = DB::query($sql);
        //dd($result);
        $data['column'] = $column;
        $data['products'] = $result;
        return View::make('Products::widget.recent',$data);
    }
    
    public function get_products($limit=5){
    	
    	
    	$data['mode'] = "PRODUCTS";
    	
    	
    	$sql = "Select * from products where status = 51 order by('id') DESC limit 0,$limit ";
    	$result = DB::query($sql);
    	
    	$data['products'] = $result;
    	
    	
    	
    	return View::make('Products::widget.recent',$data);
    }
    
}